<?php
include("config.php");
if (isset($_COOKIE["ImOnline"])){
	//print($_COOKIE["ImOnline"]);
	//print("Welcome back " . $_COOKIE["Username"]);
} else {
	header( 'Location: index.php?error=You have no access to this page' );
	die("<center><br><br><br><img src=\"img/logo.jpg\" \><br>Your webbrowser dont support redirecting.<br>You have no access to this page. <br><a href=\"index.php\">Please go to main page</a></center>");
	//print($_COOKIE["imonline"]);
	};
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Logs - Garrysmod Web</title>
</head>

<body>
<div id="page-wrap">
<?php
include("includes/header.html");
?>
<p>The Server Log Entries:</p>
<?php
$con = @mysql_connect($host,$username,$password) or die("Cant connect to host");
@mysql_select_db($db) or die( "Unable to select database");

$query="SELECT * FROM log ORDER BY id DESC LIMIT 1, 400";
$result=mysql_query($query,$con);

$num=mysql_num_rows($result);
?>
<p align="left">
<?php
$i=0;
if ($num == 0){
	print("No log entries found!");
};
while ($i < $num) {
$log=mysql_result($result,$i,"Log");
print("$log<br>");

$i++;
};
mysql_close($con);
?>
</p>
  </div>
<?php
include("includes/footer.html");
?>
</body>
</html>